using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;

public class Exercises : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        #region Lesson5 练习题

        // 尝试自己写一个 Addressables 资源管理器
        // 帮助我们通过名字加载单个资源或场景,并管理资源相关内容
        AddressablesMgr.Instance.LoadAssetAsync<GameObject>("Cube", handle =>
        {
            Instantiate(handle.Result);
        });
        AddressablesMgr.Instance.LoadAssetAsync<GameObject>("Cube", handle =>
        {
            var o = Instantiate(handle.Result);
            o.transform.Translate(1, 0, 1);
        });
        #endregion

        #region Lesson6 练习题

        AddressablesMgr.Instance.LoadAssetAsync<Object>(Addressables.MergeMode.Intersection, handle =>
        {
            print("1"+ handle.name);
        }, "Cube", "Red");
        
        AddressablesMgr.Instance.LoadAssetAsync<Object>(Addressables.MergeMode.Intersection, handle =>
        {
            print("2"+ handle.name);
        }, "Cube", "Red");

        #endregion
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
